
/**************         自动部署控制器控制器             ******************/
const Tool       = require('./tool.js')
const { resolve } = require('path')


class DeploymentController {
  
  //获取上传图片认证
   static async deploymentApp1(ctx) {
        const data = ctx.request.body 

        if (data) {
          // 部署 项目 

          let sh_path = __dirname + '/shells/' + 'root.sh'                      // 脚本地址
          let currentPath = "/Users/duanpw/Desktop/测试自动部署/"   // 需要部署的地址
          let msg = await Tool.deploymentApp(sh_path , currentPath)
          ctx.body = {
              code: 1,
              message: msg, 
            }
        } else {
          ctx.body = {
            code: -1,
            message: '密码错误', 
          }
        }
      
       
    } 

}




module.exports = DeploymentController
